package com.qcby.demo.proxyaop.interceptor;

import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.Method;

/**
 * @className: QcbyInterceptor
 * @description: 拦截器实现类
 * @author: lxt
 * @create: 2021-05-12 16:04
 **/
@Slf4j
public class QcbyInterceptor implements Interceptor{

    @Override
    public boolean preHandle(Object proxy, Object target, Method method, Object[] args) {
        log.info("这是【preHandle】方法,预处理：目标方法执行之前执行，默认返回true继续向下执行,返回false目标方法不执行");
        return true;
    }

    @Override
    public void postHandle(Object proxy, Object target, Method method, Object[] args) {
        log.info("这是【postHandle】方法，后处理：目标方法执行完毕，返回之前");
    }

    @Override
    public void afterCompletion(Object proxy, Object target, Method method, Object[] args) {
        log.info("这是【afterCompletion】方法。。。此方法一定会执行，final中");
    }
}
